<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Point(x, y) {
        console.log(this) // 实例对象p1
        this.x = x
        this.y = y
        this.moveTo = function(x, y) {
          this.x = x
          this.y = y
          console.log(this.x) // p1.x = 1
          console.log(this.y) // p1.y = 1
        }
      }
      var p1 = new Point(0, 0)

      var p2 = {
        x: 0,
        y: 0
      }
      p1.moveTo(1, 1) //1 1
      p1.moveTo.apply(p2, [10, 10]) // p2.x = 10 p2.y = 10

      console.log(x) // x is not defined
      console.log(y) // y is not defined
    </script>
  </body>
</html>
